import $ from './library/jquery.js';

$.ajax({
    type: "get",
    url: "../../interface/getData.php",
    dataType: "json",
}).then(function(data) {

    let temp = '';
    data.forEach((elm, i) => {
        let picture = JSON.parse(elm.picture);
        temp += `<li>
        <a href="./Detail Pages.html?item=${elm.id}">
            <div>
                <img src="../${picture[0].src}" alt="">
            </div>
            <h3>${elm.title}</h3>
            <p>${elm.details}</p>
            <p>
                <span>${elm.price}元起</span>
                <del>${elm.dell}</del>
            </p>
        </a>
    </li>`;
    });
    $('.list').html(temp);
}).catch(function(xhr) {
    console.log(xhr.status);
});